<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>投票结果</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 40px 20px;
            color: #333;
        }
        
        .container {
            max-width: 800px;
            width: 100%;
            background: white;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            overflow: hidden;
            margin-top: 20px;
            animation: slideUp 0.6s ease-out;
        }
        
        @keyframes slideUp {
            from { opacity: 0; transform: translateY(30px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        header {
            background: linear-gradient(to right, #4b6cb7, #182848);
            color: white;
            padding: 30px 40px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        
        header::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(to right, #ff6b6b, #ffa502);
        }
        
        h1 {
            font-size: 2.2rem;
            font-weight: 600;
            margin-bottom: 10px;
            position: relative;
            z-index: 2;
        }
        
        .question-text {
            font-size: 1.4rem;
            font-weight: 500;
            margin-top: 25px;
            color: #2c3e50;
            padding-bottom: 15px;
            border-bottom: 1px solid #f0f0f0;
            display: flex;
            align-items: center;
        }
        
        .question-text i {
            color: #4b6cb7;
            margin-right: 12px;
            font-size: 1.8rem;
        }
        
        .content {
            padding: 40px;
        }
        
        .results-container {
            margin: 30px 0;
        }
        
        .results-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }
        
        .total-votes {
            background: #f0f5ff;
            padding: 8px 20px;
            border-radius: 50px;
            font-weight: 600;
            color: #4b6cb7;
            display: flex;
            align-items: center;
        }
        
        .total-votes i {
            margin-right: 8px;
        }
        
        .results-list {
            list-style: none;
            margin-top: 20px;
        }
        
        .result-item {
            margin-bottom: 25px;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            border: 1px solid #eaeaea;
        }
        
        .choice-header {
            display: flex;
            justify-content: space-between;
            padding: 15px 20px;
            background: #f9fbfd;
            border-bottom: 1px solid #eee;
        }
        
        .choice-text {
            font-size: 1.1rem;
            font-weight: 500;
            color: #2c3e50;
            display: flex;
            align-items: center;
        }
        
        .choice-text i {
            color: #4b6cb7;
            margin-right: 10px;
        }
        
        .votes-count {
            font-weight: 600;
            background: #e4edf5;
            padding: 8px 16px;  /* 增大内边距使更突出 */
            border-radius: 20px;
            font-size: 0.95rem;  /* 稍大字体 */
            color: #2c3e50;
        }
        
        /* 已移除进度条相关样式 */
        
        .actions {
            display: flex;
            justify-content: space-between;
            margin-top: 40px;
            flex-wrap: wrap;
            gap: 15px;
        }
        
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 14px 28px;
            border-radius: 12px;
            font-weight: 600;
            text-decoration: none;
            transition: all 0.3s ease;
            font-size: 1rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        
        .btn-primary {
            background: linear-gradient(to right, #4b6cb7, #182848);
            color: white;
        }
        
        .btn-secondary {
            background: white;
            color: #4b6cb7;
            border: 2px solid #4b6cb7;
        }
        
        .btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
        }
        
        .btn i {
            margin-right: 8px;
        }
        
        footer {
            text-align: center;
            padding: 25px;
            color: #7f8c8d;
            font-size: 0.9rem;
            border-top: 1px solid #eee;
            background: #f9fbfd;
        }
        
        .winner-badge {
            display: inline-block;
            background: linear-gradient(to right, #ff6b6b, #ffa502);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            margin-left: 10px;
            animation: pulse 2s infinite;
        }
        
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        
        @media (max-width: 600px) {
            .content {
                padding: 25px 20px;
            }
            
            header {
                padding: 25px 20px;
            }
            
            h1 {
                font-size: 1.8rem;
            }
            
            .question-text {
                font-size: 1.2rem;
            }
            
            .actions {
                flex-direction: column;
            }
            
            .btn {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <header>
            <h1><i class="fas fa-chart-pie"></i> 投票结果</h1>
            <p>查看当前投票结果和统计数据</p>
        </header>
        
        <div class="content">
            <div class="question-text">
                <i class="fas fa-question-circle"></i>
                {{ question.question_text }}
            </div>
            
            <div class="results-container">
                <div class="results-header">
                    <h2><i class="fas fa-poll"></i> 投票结果</h2>
                    <div class="total-votes">
                        <i class="fas fa-vote-yea"></i>
                        总投票数: {{ total_votes }} 票
                    </div>
                </div>
                
                <ul class="results-list">
                    {% for choice in question.choice_set.all %}
                    <li class="result-item">
                        <div class="choice-header">
                            <div class="choice-text">
                                <i class="fas fa-circle"></i>
                                {{ choice.choice_text }}
                                {% if choice.votes == max_votes and choice.votes > 0 %}
                                <span class="winner-badge">领先</span>
                                {% endif %}
                            </div>
                            <div class="votes-count">
                                {{ choice.votes }} 票 ({{ choice.percentage|floatformat:"1" }}%)
                            </div>
                        </div>
                        <!-- 已移除进度条容器 -->
                    </li>
                    {% endfor %}
                </ul>
            </div>
            
            <div class="actions">
                <a href="{% url 'polls:detail' question.id %}" class="btn btn-primary">
                    <i class="fas fa-redo-alt"></i> 重新投票
                </a>
                <a href="{% url 'polls:index' %}" class="btn btn-secondary">
                    <i class="fas fa-arrow-left"></i> 返回问题列表
                </a>
            </div>
        </div>
        
        <footer>
            <p>投票应用 &copy; 2023 - 公正透明的投票结果</p>
        </footer>
    </div>
    
    <script>
        // 已移除进度条动画脚本
        
        // 保留领先选项的闪烁效果
        const winnerBadges = document.querySelectorAll('.winner-badge');
        winnerBadges.forEach(badge => {
            setInterval(() => {
                badge.style.opacity = badge.style.opacity === '0.7' ? '1' : '0.7';
            }, 1500);
        });
    </script>
</body>
</html>